package com.itheima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface ReportMapper extends BaseMapper {
    @Select("SELECT count(tm.id) as totalCounts,CONCAT(rp.fyear,\"-\",rp.fmonth) as yearAndMonth " +
            "FROM t_member tm,rpt_date rp " +
            "WHERE tm.REGTIME = rp.fdate " +
            "and rp.fyear = year(now())-1 " +
            "group by rp.fmonth")
    List<Map> findMemberLastYear();

    @Select("SELECT count(ts.id) as value,ts.name as name " +
            "FROM t_setmeal ts,t_order tor " +
            "WHERE ts.id  = tor.SETMEAL_ID " +
            "group by ts.id " +
            "order by value desc")
    List<Map> findSetmealProportion();

}
